
// 登录方法
const login = {
  url: "/login",
  method: "post",
  response: (ops) => {
    let retData ={code:200,data:[],msg:""}
    // debugger;
    let params = JSON.parse(ops.body);
    if(!params.username || !params.password){
      retData.code=300;
      retData.msg="用户名、密码不能为空"
      return retData;
    }
    if(params.username=="admin"  && params.password=="admin123"){
      retData.code=200;
    }else{
      retData.code=300;
      retData.msg="测试用户名 admin 密码 admin123 "
    }
    return retData;
    // return {
    //   code: 200,
    //   data: [
    //     {
    //       "id": 1,
    //       "username": "zhoujielun",
    //       "password": "123456"
    //     },
    //     {
    //       "id": 2,
    //       "username": "guojingming",
    //       "password": "666666"
    //     },
    //   ]
    // }
  }
}

// 获取用户详细信息
const getInfo = {
  url: '/getInfo',
  method: 'get',
  response: () => {
    return {
      code: 200,
      data: [
        {
          "id": 1,
          "username": "zhoujielun",
          "password": "123456"
        },
        {
          "id": 2,
          "username": "guojingming",
          "password": "666666"
        },
      ]
    }
  }
}

// 退出方法
const logout = {
  url: '/logout',
  method: 'post',
  response: () => {
    return {
      code: 200,
      data: [
        {
          "id": 1,
          "username": "zhoujielun",
          "password": "123456"
        },
        {
          "id": 2,
          "username": "guojingming",
          "password": "666666"
        },
      ]
    }
  }
}

export function aa() {
  return {
    url: '/aa',
    method: 'post',
    response: () => {
      return {
        code: 200,
        data: [
          {
            "id": 1,
            "username": "zhoujielun",
            "password": "123456"
          },
          {
            "id": 2,
            "username": "guojingming",
            "password": "666666"
          },
        ]
      }
    }
  }
}

//方式-
let ret =[];
ret.push(aa);
ret.push(login);
ret.push(getInfo);
ret.push(logout);
// module.exports = ret;

export default ret;


//方式一
// module.exports = [
//   login,
//   getInfo,
//   logout,
//   aa
// ]

